package com.crm.manager.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.crm.manager.domain.Activity;
import com.crm.manager.domain.Contracts;
import com.crm.manager.domain.dto.ContractDto;
import com.crm.manager.domain.dto.ContractStatisticPageDto;
import com.crm.manager.domain.vo.ContractStatisticPageVo;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ContractMapper extends BaseMapper<Contracts> {

    // 获得每天新增的客户数
    Integer getEveryDayClientCounts(@Param("timeInterval") String timeInterval);
    int insertContract(ContractDto contract);

    @Select("SELECT * FROM contracts WHERE id = #{id}")
    Contracts getContractById(@Param("id") String id);
    @Select("SELECT * FROM contracts WHERE id = #{id}")
    Contracts ContractById(Integer id);

    void updata(Contracts contracts);

    Page<Activity> page(ContractDto contractDto);


    // 获得当前的客户总数
    Integer getClientTotals(String currentDate);

    // 客户统计分页查询
    List<ContractStatisticPageVo> clientStatisticPageQuery(ContractStatisticPageDto dto);
}
